-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Components: Stop re-exporting experimental utilities from @wordpress/components
#62155
base: trunk
Are you sure you want to change the base?
Components: Stop re-exporting experimental utilities from @wordpress/components
#62155
Conversation
…he external re-export from `@wordpress-components` and start replacing app consumers to import it from `block-editor` Start with `hasSplitBorders`
a4af26d
to
6c951ba
Compare
Size Change: +52 B (0%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
@@ -35,6 +35,7 @@ export { | |||
|
|||
export { default as __experimentalStyleProvider } from './style-provider'; | |||
export { default as BaseControl } from './base-control'; | |||
// @todo review this RN export | |||
export { hasSplitBorders as __experimentalHasSplitBorders } from './border-box-control/utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know much about our RN setup. If we go with the approach in this PR, should we also remove this and copy it over closer to where the native is? I'm not sure if we should also remove it from RN at this point. I did search throughout GB, and it also looks like it's not being used by RN consumers in the codebase, but I'm not sure if it could be used by other third-party RN packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dcalhoun @WordPress/native-mobile can you please confirm that it's safe to remove this export? Thank you! 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋🏻 Thanks for the ping.
The mobile unit tests are passing on the CI server, so that is a good sign. 😄 I did not encountering any issues after checking out the proposed changes and "smoke testing" the editor on an iPhone simulator.
From quickly reviewing the related code, my perception is that __experimentalHasSplitBorders
is not utilized by the native mobile editor. So, removing this export should likely be safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me so far. Ping when ready and I'll be happy to do a deeper review. Thanks!
Taking over. |
@@ -175,3 +175,5 @@ export { useBlockCommands } from './use-block-commands'; | |||
* The following rename hint component can be removed in 6.4. | |||
*/ | |||
export { default as ReusableBlocksRenameHint } from './inserter/reusable-block-rename-hint'; | |||
|
|||
export * from './border-box-utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the packages/block-editor/src/utils
be a better folder instead of the components
folder for these utils?
This time you beat me to it! I'll be happily help with reviews on this one. I'll also add a label re. leaving a dev note for devs who may be experiencing breakages, recommending they import those same utils from the |
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
Issue: #61135
Related: #59418
What?
@wordpress/components
;Why?
There are a few exports from
@wordpress/components
that smell, more specifically the ones listed in the aforementioned issue. These are utilities/helper functions that were developed as part of theBorderBox
component but that ended up leaking to other packages in the Gutenberg app. The main problem here is that the wp-components package is not the best place to export shared utilities like this from.This PR attempts to start solving that by first identifying where else in Gutenberg those utilities were being used, and copying them over to a tidy-up module in a package that makes more sense to them, which, as per @DaniGuardiola's initial analysis, would be
block-editor
(see the linked issue).Later, we might DRY all these and other semantically related utilities (see the issue) into a single package that can be shared between multiple packages, including wp-components. This will be discussed and done in a follow-up.
How?
isDefinedBorder
andhasSplitBorders
to a module inblock-ediotr/components/border-box-utils
;tsconfig.json
to support the module;isEmptyBorder
from the new module as it's not being used outside of wp-components and in this case is only used internally.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
TODO